package com.llb666.e.shop.api.dto;

import com.llb666.e.shop.domain.entity.UserAddress;
import lombok.Data;
import org.mapstruct.MapMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import javax.crypto.spec.PSource;

/**
 * @author 斌~
 * @date 2022/9/11 下午11:03
 */
@Data
public class UserAddressDto {
    /**
     * 地址主键id
     */
    private String addressId;
    /**
     * 关联用户id
     */
    private String userId;
    /**
     * 收件人姓名
     */
    private String receiver;
    /**
     * 收件人手机号
     */
    private String mobile;
    /**
     * 省份
     */
    private String province;
    /**
     * 城市
     */
    private String city;
    /**
     * 区县
     */
    private String district;
    /**
     * 详细地址
     */
    private String detail;


    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        UserAddressDto.Converter INSTANCE = Mappers.getMapper(UserAddressDto.Converter.class);

        @Mapping(source = "addressId", target = "id")
        UserAddress dto2do(UserAddressDto activity);
    }
}
